package otcv.hr.log;

/**
 * @author : H-Thien
 * @comment :
 */
public class Logger {

	/**
	 * @comment :
	 */
	public static void error(Exception exception) {
		String message = exception.getLocalizedMessage();
		StackTraceElement[] trace = exception.getStackTrace();
		for (int i = 0; i < trace.length; i++) {
			message += "\n" + trace[i].toString();
		}
		LogWriter.getInstance().write(LogWriter.ERROR_LOG, message);
	}

	/**
	 * @comment :
	 */
	public static void error(String message) {
		LogWriter.getInstance().write(LogWriter.ERROR_LOG, message);
	}

	/**
	 * @comment :
	 */
	public static void warning(Exception exception) {
		String message = exception.getLocalizedMessage();
		StackTraceElement[] trace = exception.getStackTrace();
		for (int i = 0; i < trace.length; i++) {
			message += "\n" + trace[i].toString();
		}
		LogWriter.getInstance().write(LogWriter.WARNING_LOG, message);
	}

	/**
	 * @comment :
	 */
	public static void warning(String message) {
		LogWriter.getInstance().write(LogWriter.WARNING_LOG, message);
	}

	/**
	 * @comment :
	 */
	public static void info(String message) {
		LogWriter.getInstance().write(LogWriter.INFO_LOG, message);
	}

	/**
	 * @comment :
	 */
	public static void debug(String message) {
		LogWriter.getInstance().write(LogWriter.DEBUG_LOG, message);
	}

	/**
	 * @comment :
	 */
	public static void debug(int message) {
		LogWriter.getInstance().debug(Integer.toString(message));
	}

	/**
	 * @comment :
	 */
	public static void debug(long message) {
		LogWriter.getInstance().debug(Long.toString(message));
	}

	/**
	 * @comment :
	 */
	public static void debug(float message) {
		LogWriter.getInstance().debug(Float.toString(message));
	}

	/**
	 * @comment :
	 */
	public static void debug(double message) {
		LogWriter.getInstance().debug(Double.toString(message));
	}

	/**
	 * @comment :
	 */
	public static void debug(char message) {
		LogWriter.getInstance().debug(Character.toString(message));
	}

	/**
	 * @comment :
	 */
	public static void debug(Exception exception) {
		String message = exception.getLocalizedMessage();
		StackTraceElement[] trace = exception.getStackTrace();
		for (int i = 0; i < trace.length; i++) {
			message += "\n" + trace[i].toString();
		}
		LogWriter.getInstance().debug(message);
	}

	/**
	 * @comment :
	 */
	public static void debug(Object message) {
		LogWriter.getInstance().debug(message.toString());
	}
}